package com.skcc.cip.ngms.mail.processor;

import org.apache.camel.Exchange;

import com.skcc.cip.component.exchange.dto._2007.jaxb.mail.mailpushsubscribe.Response;
import com.skcc.cip.ngms.dto.request.jaxb.mailpush.CommonMailPushSubscribeRequest;

//DB 사용안할때 임시코딩
public class TransformDatabaseData{

	public void insertPushList(Exchange exchange) {

		Response response = exchange.getIn().getBody(Response.class);
		CommonMailPushSubscribeRequest request = (CommonMailPushSubscribeRequest) exchange.getProperty("subscribeInfo");
		exchange.getIn().getHeader("registrationId");
		
		SubscribeData data = new SubscribeData();
		
		data.setAuthId((String) exchange.getIn().getHeader("authUser"));
		data.setAuthPassword((String) exchange.getIn().getHeader("authPassword"));
		data.setAuthDomain((String) exchange.getIn().getHeader("authDomain"));
		data.setAuthHost((String) exchange.getIn().getHeader("authHost"));
		data.setAuthToken(request.getAuthToken());
		data.setStatusFrequency(Integer.toString(request.getStatusFrequency()));
		data.setSubscribeId(response.getMetaInfo().getSubscriptionId());
		data.setRegistrationId(request.getRegistrationId());
		
		exchange.getIn().setBody(data);
	}
	
}
